import os
import shutil
import random
import glob
import math

# 获取图片路径
img_paths = glob.glob('./wechat_images/*.png') + \
            glob.glob('./toutiao_images/*.png')[:235]

# 按8:2 将数据切分
random.seed(666)
random.shuffle(img_paths)


# copy图片
def copy_file(path_list, dst_path):
    cur_index = 1000

    for cur_path in path_list:

        try:
            shutil.copyfile(cur_path, os.path.join(dst_path, str(cur_index) + '.png'))
            cur_index += 1
        except:
            print(cur_path)
            print(os.path.join(str(cur_index) + '.png'))
            raise Exception('ting')


copy_file(img_paths, './need_process_data/data')

# with open('./z_images/92.png', 'rb') as f:
#     line = f.read()
#
#     print(line)

